#!/bin/bash
# 定时压缩并删除原始数据
DATE1=`date -d "1 day ago" +%Y/%m/%d`
DATE2=`date -d "1 day ago" +%Y%m%d`

cd /opt/docker_daq/raw

if zip -r -q -o $DATE2.zip $DATE1; then
  rm -rf $DATE1;
  echo "Data for $DATE1 has been zipped and deleted."
fi

crontab -e
20 0 * * * sh /opt/docker_daq/zip_raw.sh